<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link href="/css/layui.css" th:href="@{/css/layui.css}" rel="stylesheet">
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" class="form-control" type="hidden">
						<div class="form-group">
							<label class="col-sm-3 control-label">存取金额(元)：</label>
							<div class="col-sm-8">
								<input id="accessMoney" name="accessMoney" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">存取模式</label>
							<div class="col-sm-8">
								<select id="accessMode" name="accessMode" class="form-control">
									<option value="1">支付</option>
									<option value="2">广告</option>
									<option value="3">无</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">纸条审核：</label>
							<div class="col-sm-8">
								<select id="noteShenhe" name="noteShenhe" class="form-control">
									<option value="1">是</option>
									<option value="2">否</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">发布审核：</label>
							<div class="col-sm-8">
								<select id="shenhe" name="shenhe" class="form-control">
									<option value="0">审核</option>
									<option value="1">不审核</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">纸条首次免费：</label>
							<div class="col-sm-8">
								<select id="firstFree" name="firstFree" class="form-control">
									<option value="1">免费</option>
									<option value="2">收费</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">推广佣金(%)：</label>
							<div class="col-sm-8">
								<input id="yongjin" name="yongjin" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">开通会员金额(元)：</label>
							<div class="col-sm-8">
								<input id="menberMoney" name="menberMoney" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">每天提现次数：</label>
							<div class="col-sm-8">
								<input id="dayCount" name="dayCount" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">最低提现金额(元)：</label>
							<div class="col-sm-8">
								<input id="minMoney" name="minMoney" class="form-control" type="text">
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button type="submit" class="btn btn-primary" id="saveBtn" onclick="update()">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>
<script src="/js/layui.js" th:src="@{/js/layui.js}"></script>

<script type="text/javascript">

	getData();
	function getData() {
		$.ajax({
			cache : true,
			type : "get",
			url : ctxPath+ "/shejiao/manheConfig/get",
			async : false,
			error : function(request) {
			},
			success : function(data) {
				console.log(data);
				let manheConfig = data.manheConfig;
				if (data.code == 0 && manheConfig != null) {
					$("#id").val(manheConfig.id);
					$("#accessMoney").val(manheConfig.accessMoney);
					$("#accessMode").val(manheConfig.accessMode);
					$("#noteShenhe").val(manheConfig.noteShenhe);
					$("#shenhe").val(manheConfig.shenhe);
					$("#firstFree").val(manheConfig.firstFree);
					$("#yongjin").val(manheConfig.yongjin);
					$("#menberMoney").val(manheConfig.menberMoney);
					$("#dayCount").val(manheConfig.dayCount);
					$("#minMoney").val(manheConfig.minMoney);

				}

			}
		});
	}


	function update() {
		$.ajax({
			cache : true,
			type : "POST",
			url : ctxPath+ "/shejiao/manheConfig/update",
			data : $('#signupForm').serialize(),// 你的formid
			async : false,
			error : function(request) {
				parent.layer.alert("Connection error");
			},
			success : function(data) {
				if (data.code == 0) {
					parent.layer.msg("操作成功");
				} else {
					parent.layer.msg(data.msg)
				}

			}
		});

	}
</script>
</body>
</html>



<script type="text/javascript" src="/js/appjs/shejiao/manheConfig/manheConfig.js" th:src="@{/js/appjs/shejiao/manheConfig/manheConfig.js}"></script>